import java.util.Scanner;

/**
 * @author gao
 * @date 2025/8/24 23:25
 */

class ListNode {
    int val;
    ListNode next;

    public ListNode(int val) {
        this.val = val;
    }
}

public class Solution {
    public ListNode oddEvenList (ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }

        // 初始化奇偶链表的头和尾
        ListNode oddHead = head;
        ListNode oddTail = head;
        ListNode evenHead = head.next;
        ListNode evenTail = head.next;

        while (evenTail != null && evenTail.next != null) {
            // 奇数节点连接
            oddTail.next = evenTail.next;
            oddTail = oddTail.next;

            // 偶数节点连接
            evenTail.next = oddTail.next;
            evenTail = evenTail.next;
        }

        // 将奇数链表和偶数链表连接
        oddTail.next = evenHead;

        return oddHead;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();

            ListNode head = null;
            ListNode tail = null;

            for (int i = 0; i < n; i++) {
                int val = in.nextInt();
                ListNode newHead = new ListNode(val);
                if (head == null) {
                    head = newHead;
                    tail = newHead;
                } else {
                    tail.next = newHead;
                    tail = newHead;
                }
            }

            Solution solution = new Solution();
            Print(solution.oddEvenList(head));
        }
    }

    private static void Print(ListNode head) {
        ListNode cur = head;
        while (cur != null) {
            System.out.print(cur.val + " ");
            cur = cur.next;
        }
    }
}